import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Scanner;

public class Demo9 {
	public static void main(String[] args) {
		StringBuffer stringBuffer=new StringBuffer();
		//将字节流转化为字符流直接输出
		try(InputStream inputStream=new FileInputStream("d:/test.txt")) {
			Scanner scanner=new Scanner(inputStream);
			while(scanner.hasNextLine()) {
				String str=scanner.nextLine();
				stringBuffer.append(str);
				stringBuffer.append("\n");
			}
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
		System.out.println(stringBuffer);
	}
}
